package com.example.fengyungo.utils;

import com.example.fengyungo.domain.ChatMessage;
import com.example.fengyungo.domain.MessageList;
import com.example.fengyungo.domain.Order;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class TestUtils {
    public static List<Order> initMainOrdersData() {
        List<Order> orders = new ArrayList<>();
        orders = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            Order order = new Order();
            order.setBegin("湖南省湘潭大学" + i);
            order.setEnd("湖南省湘潭大学" + i);
            order.setPrice(5.5*i);
            orders.add(order);
        }
        return orders;
    }

    public static List<Order> initMyOrdersData() {
        List<Order> orders = new ArrayList<>();
        orders = new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            Order order = new Order();
            order.setBegin("湖南省湘潭大学" + i);
            order.setEnd("湖南省湘潭大学" + i);
            order.setOrderStatus(i % 2 + 1);
            order.setPrice(5.5*i);
            if (i % 2 + 1 == 2) {
                order.setCredit(new Random().nextFloat()*100%5);
            }
            orders.add(order);
        }
        return orders;
    }

    public static List<MessageList> initMessageListData() {
        List<MessageList> messageLists = new ArrayList<>();
        for (int i = 0; i < 15; i++) {
            MessageList messageList = new MessageList();
            messageList.setUserNickname("小明"+i);
            messageList.setLastContent("君不见，黄河之水天上来"+i);
            messageList.setLastTime("12-"+i);
            messageList.setDriverUnread(i);

            messageLists.add(messageList);
        }
        return messageLists;
    }

    public static List<ChatMessage> initChatMessageList() {
        List<ChatMessage> chatMessageList = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            ChatMessage chatMessage = new ChatMessage();
            chatMessage.setContent("君不见，黄河之水天上来"+i);
            int type = new Random().nextInt();
            if (type < 0) {
                type *= (-1);
            }
            type %= 2;
            chatMessage.setMessageType(type);

            chatMessageList.add(chatMessage);
        }
        return chatMessageList;
    }
}
